home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / video / simpleVideo / include / sv.h next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  5.9 KB  |  244 lines

  1. /*
  2.  * Copyright (c) 1994, Silicon Graphics, Inc.
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and
  5.  * its documentation for any purpose is hereby granted without fee, provided
  6.  * that the name of Silicon Graphics may not be used in any advertising or
  7.  * publicity relating to the software without the specific, prior written
  8.  * permission of Silicon Graphics.
  9.  *
  10.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
  11.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
  12.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  13.  *
  14.  * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  15.  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
  16.  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
  17.  * POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
  18.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  19.  */
  20. /* $Id: sv.h,v 1.6 1994/07/16 01:48:26 dpb Exp $ */
  21.  
  22. /**********************************************************************
  23.  *  
  24.  * sv.h - simple video interface defines and function prototypes;
  25.  *
  26.  **********************************************************************
  27.  */
  28.  
  29. #ifndef _SV_H
  30. #define _SV_H
  31.  
  32. #include "vlUtil.h"
  33.  
  34.  
  35. /**********************************************************************
  36.  * sv return codes - here's what can go wrong;
  37.  **********************************************************************
  38.  */
  39.  
  40. #define svSuccess              0
  41. #define svInitFailed              1
  42. #define svDeviceNotFound          2
  43. #define svBadInputConnection      3
  44. #define svBadOutputConnection     4
  45. #define svBadInputNode            5
  46. #define svBadOutputNode           6
  47. #define svBadPath                 7
  48. #define svBadPathSetup            8
  49. #define svBufferAllocFailed       9
  50. #define svBufferRegisterFailed   10
  51. #define svBeginTransferFailed    11
  52. #define svEndTransferFailed      12
  53. #define svEndTransferFixupFailed 13
  54. #define svBufferResetFailed      14
  55. #define svBadFile                15
  56. #define svBadImageType         16
  57. #define svCompressMissing     17
  58. #define svCompressFailed     18
  59. #define svFileWriteFailed     19
  60.  
  61. /**********************************************************************
  62.  * Context management -
  63.  **********************************************************************
  64.  */
  65.  
  66. typedef int svContext;
  67.  
  68. svContext
  69. svNewContext(void);
  70.  
  71. void
  72. svSetContext(svContext);
  73.  
  74. svContext
  75. svCurrentContext(void);
  76.  
  77. void
  78. svFreeContext(svContext);
  79.  
  80.  
  81. /**********************************************************************
  82.  * Input/Output selection - 
  83.  *
  84.  * Functions to select the input connection for svGetFrame(),
  85.  * and the output connection for svPutFrame() -
  86.  * choose from the list below;
  87.  **********************************************************************
  88.  */
  89.  
  90.  
  91. /*
  92.  * Indy connections -
  93.  */
  94.  
  95. #define vnINPUT_INDYCAM        1
  96. #define vnINPUT_COMPOSITE    2
  97. #define vnINPUT_SVIDEO        3
  98.  
  99.  
  100. /*
  101.  * Galileo connections -
  102.  */
  103.  
  104. #define gvINPUT_COMPOSITE_1    4
  105. #define gvINPUT_SVIDEO        5
  106. #define gvINPUT_COMPOSITE_2    6
  107. #define gvINPUT_DIGITAL_1    7
  108. #define gvINPUT_DIGITAL_2    8
  109. #define gvOUTPUT_ANALOG        9
  110. #define gvOUTPUT_DIGITAL       10
  111.  
  112.  
  113. void svSelectInput(int);
  114. void svSelectOutput(int);
  115.  
  116. /**********************************************************************
  117.  * Frame & image file allocation/deallocation, input/output -
  118.  **********************************************************************
  119.  */
  120.  
  121. /* magic numbers */
  122.  
  123. #define RGB_MAGIC        0x1da
  124. #define RGB_SV_IMAGE_MAGIC    0x1db
  125.  
  126. typedef struct {
  127.     int width;
  128.     int height;
  129.     int packing;
  130.     int dataMalloced;
  131.     int dataSize;
  132.     int compressed;
  133.     char *data;
  134. } svImage;
  135.  
  136.  
  137. /* The returned image should be freed with svFreeImage() */
  138. svImage *
  139. svNewImage(void);
  140.  
  141. void
  142. svFreeImage(svImage **);
  143.  
  144. int
  145. svSaveImage(char *filename,
  146.         svImage *frame);
  147.  
  148. /* svLoadImage will allocate an svImage record and fill it in,
  149.  * you must free it with svFreeImage();
  150.  */
  151. int
  152. svLoadImage(char *filename,
  153.         svImage **frame /* return */);
  154.  
  155. int
  156. svViewImage(svImage *frame, int x, int y);
  157.  
  158. void
  159. svCompressedImages(int saveCompressed);
  160.  
  161.  
  162. /**********************************************************************
  163.  * Frame data packing;
  164.  *
  165.  * valid values are the #defines that start VL_PACKING_ in vl.h,
  166.  * currently supported values are:
  167.  *
  168.  * VL_PACKING_RGBA_8
  169.  * VL_PACKING_RGB_8
  170.  * VL_PACKING_YVYU_422_8
  171.  *
  172.  * Others may work, these are the the only ones I've tried...
  173.  *
  174.  **********************************************************************
  175.  */
  176.  
  177. void
  178. svSetImagePacking(int packingType);
  179.  
  180.  
  181. /**********************************************************************
  182.  * Use these functions to read a frame of video into an image or
  183.  * to write an image out to video.
  184.  **********************************************************************
  185.  */
  186.  
  187. int
  188. svGetFrame(svImage *);
  189.  
  190. int
  191. svPutFrame(svImage *);
  192.  
  193. /**********************************************************************
  194.  * node/control access;
  195.  *
  196.  * Pass in VL_LOCK if desired, default is VL_SHARE;
  197.  **********************************************************************
  198.  */
  199.  
  200. void
  201. svNodeAccessMode(VLUsageType);
  202.  
  203. void
  204. svControlAccessMode(VLUsageType);
  205.  
  206. /*  if we use a usage mode of VL_SHARE, we may want
  207.  *  to automatically try and recover if our transfer in
  208.  *  progress is pre-empted;
  209.  */
  210.  
  211. void
  212. svRecoverFromPreemption(void);
  213.  
  214. /**********************************************************************
  215.  * Modify transfer parameters;
  216.  *
  217.  * Default count = 1,
  218.  * transfer mode = DISCRETE;
  219.  *
  220.  **********************************************************************
  221.  */
  222.  
  223. void
  224. svSetFrameCount(int);
  225.  
  226.  
  227. #define svTRANSFER_DISCRETE    0
  228. #define svTRANSFER_CONTINUOUS    1
  229.  
  230. void
  231. svSetTransferMode(int);
  232.  
  233. /**********************************************************************
  234.  * Setup path callback hook
  235.  **********************************************************************
  236.  */
  237. typedef int (*SVSetupPathCallback)(VLServer, VLPath, VLNode, VLNode);
  238.  
  239. void
  240. svSetupPathCallback(SVSetupPathCallback);
  241.  
  242. #endif /* SV_H */
  243.  
  244.